import type { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue';
import { genBankLayout } from '@/utils/routerUtils';

export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    component: Layout,
    name: 'Root',
    meta: {
      title: '错误页面管理',
      icon: 'User'
    },
    children: [
      {
        path: '/error01',
        component: () => import('@/views/global/error/index.vue'),
        name: 'Error01',
        meta: {
          icon: 'User',
          title: '测试'
        }
      },
      {
        path: '/error02',
        component: () => import('@/views/global/error/index.vue'),
        name: 'Error02',
        meta: {
          title: '测试02'
        }
      },
      {
        path: '/error03',
        component: () => import('@/views/global/error/index.vue'),
        name: 'Error03',
        meta: {
          title: '测试03'
        }
      },
      {
        path: '/error04',
        component: () => import('@/views/global/error/index.vue'),
        name: 'Error04',
        meta: {
          title: '测试04'
        }
      }
    ]
  },
  {
    path: '/redirect',
    component: Layout,
    name: 'Redirect',
    children: [
      {
        path: '/redirect/:path(.*)',
        name: 'Redirect',
        component: () => import('@/views/global/redirect/index.vue'),
        meta: {}
      }
    ],
    meta: {
      hidden: true,
      noTagsView: true
    }
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'Login',
    meta: {
      hidden: true,
      title: '登录',
      noTagsView: true
    }
  },
  {
    path: '/error',
    component: () => import('@/views/global/error/index.vue'),
    name: 'Error',
    meta: {
      hidden: true,
      title: '404',
      noTagsView: true
    }
  }
];

export const asyncRoutes: RouteRecordRaw[] = [
  {
    path: '/platform',
    component: Layout,
    name: 'Platform',
    meta: {
      title: '平台管理',
      icon: 'Menu'
    },
    children: [
      {
        path: 'sys',
        component: genBankLayout(),
        name: 'PlatformSys',
        meta: {
          title: '系统管理',
          icon: 'Menu'
        },
        children: [
          {
            path: 'dept1',
            component: () => import('@/views/platform/dept/index.vue'),
            name: 'Dept1',
            meta: {
              icon: 'Menu',
              title: '部门管理'
            }
          },
          {
            path: 'user1',
            component: () => import('@/views/platform/user/index.vue'),
            name: 'User1',
            meta: {
              icon: 'User',
              title: '用户管理'
            }
          }
        ]
      },
      {
        path: 'dept',
        component: () => import('@/views/platform/dept/index.vue'),
        name: 'Dept',
        meta: {
          icon: 'Menu',
          title: '部门管理'
        }
      },
      {
        path: 'user',
        component: () => import('@/views/platform/user/index.vue'),
        name: 'User',
        meta: {
          icon: 'User',
          title: '用户管理'
        }
      },
      {
        path: 'person',
        component: () => import('@/views/platform/person/index.vue'),
        name: 'Person',
        meta: {
          icon: 'User',
          title: '人员管理'
        }
      },
      {
        path: 'authority',
        component: () => import('@/views/platform/authority/index.vue'),
        name: 'Authority',
        meta: {
          icon: 'User',
          title: '权限管理'
        }
      }
    ]
  }
];
